package com.woniu.service.Impl.backpage;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniu.dao.backpage.DepotDao;
import com.woniu.dao.backpage.SortingDao;
import com.woniu.entity.Sorting;
import com.woniu.service.backpage.ISortingService;
import com.woniu.util.RequestParams;
import com.woniu.util.ResData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 分拣表实现层
 * @author 任楷锐
 * @data 2023/3/9 10:31
 */
@Service
public class SortingServiceImpl implements ISortingService {
    @Autowired
    private SortingDao sortingDao;


    //查询分拣监控信息
    @Override
    public ResData<?> getAllSorting(RequestParams<Sorting> requestParams) {
        /*实现分页*/
        PageHelper.startPage(requestParams.getPageNo(), requestParams.getPageSize());
        List<Sorting> sortingList = sortingDao.findAllSorting(requestParams.getData().getMultiple(), requestParams.getData().getState(),
                requestParams.getData().getRegion(), requestParams.getData().getStartTime(), requestParams.getData().getEndTime());
        PageInfo<Sorting> pageInfo = new PageInfo<>(sortingList);

        return new ResData<>().ok(pageInfo);
    }
}

